package com.talent.core.protocol.mqtt.model.entity;

import com.talent.core.protocol.mqtt.model.request.TlMqttPublishReq;

/**
 * @ClassName：TlWillMessage
 * @Author: hszhou
 * @Date: 2024/12/27 15:27
 * @Description: 保留消息
 */
public class TlMessage implements Comparable  {

    private String topic;

    private Long timestamp;

    private TlMqttPublishReq req;

    private int qos;

    public int getQos() {
        return qos;
    }

    public void setQos(int qos) {
        this.qos = qos;
    }

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public Long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Long timestamp) {
        this.timestamp = timestamp;
    }

    public TlMqttPublishReq getReq() {
        return req;
    }

    public void setReq(TlMqttPublishReq req) {
        this.req = req;
    }


    @Override
    public int compareTo(Object o) {
        TlMessage message = (TlMessage) o;

        Long v = this.timestamp - message.timestamp;

        return v.intValue();

    }
}
